﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Text.Json;
using System.Text.Unicode;
using Xfm.Core.Options;

namespace Xfm
{
    public class XfmConfig
    {
        public static XfmOptionConfig DefaultXfOptionConfig = new XfmOptionConfig() { FileDir = "config", FileEncoding = Encoding.UTF8 };
        public static JsonSerializerOptions DefaultJsonSerializerOptions = new JsonSerializerOptions()
        {
            WriteIndented = true,
            Encoder = System.Text.Encodings.Web.JavaScriptEncoder.Create(UnicodeRanges.All)
        };
        public XfmConfig()
        {
            //添加GBK支持
            //Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
        }
        public IDictionary<string, IXfmOption> XfmOptions = new Dictionary<string, IXfmOption>();
        /// <summary>
        /// 添加IXfOption，key为xfOption的Key
        /// </summary>
        /// <param name="xfOption"></param>
        public void AddOption(IXfmOption xfOption)
        {
            XfmOptions.Add(xfOption.Key, xfOption);
        }
    }
}
